#include "UdpServer.hpp"
#include <memory>

//整理发来的信息
std::string PrintMessage(const std::string& msg){
    std::string temp = "Server# ";
    std::cout << "Client# " << msg << std::endl;
    return (temp + msg);
}

void Usage(std::string proc){
    std::cout << "Usage: Port" << std::endl;
}
int main(int argc, char* argv[]){
    if(argc != 2){
        Usage(argv[0]);
        exit(0);
    }

    //获取Port
    uint16_t Port = std::stoi(argv[1]);

    std::unique_ptr<UdpServer> Server(new UdpServer(Port));

    //启动服务器
    Server->Init();
    Server->Run(PrintMessage);

    return 0;
}